Round, don't truncate lowrance coords on write
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 6 Jul 2013 21:00:12 +0000 (21:00 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 6 Jul 2013 21:00:12 +0000 (21:00 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4401 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/lowranceusr.cc
gpsbabel/reference/enchilada.usr
gpsbabel/reference/ignoreicons.usr
gpsbabel/reference/lowrance.usr
gpsbabel/testo.d/classic-1.test
gpsbabel/testo.d/lowranceusr.test [new file with mode: 0644]

index 233dbe57614462c9d9c0f08a3f35146aadea923b..0c1685b5d65608fec97ff30ab03fa42b9fd9f083 100644 (file)
@@ -362,7 +362,7 @@ lon_mm_to_deg(double x)
 static long
 lon_deg_to_mm(double x)
 {
-  return (long)(x * SEMIMINOR * DEGREESTORADIANS);
+  return lround(x * SEMIMINOR * DEGREESTORADIANS);
 }
 
 static double
index 7df3252975dcc005fcb5a1d462a8b8d3596853b3..3721d42477210882c614b94a54a00cfe3b09c3ec 100644 (file)
Binary files a/gpsbabel/reference/enchilada.usr and b/gpsbabel/reference/enchilada.usr differ
index f3724e4b313be9f9c62eee41c9f958a3d6b9efb4..e7c3484d2386b43fe2a363d468dc61e1f77b5661 100644 (file)
Binary files a/gpsbabel/reference/ignoreicons.usr and b/gpsbabel/reference/ignoreicons.usr differ
index 26350d0292457fd874791cdd7e32be69f2700ee3..3de22550921947b97bb78018207cdab491072926 100644 (file)
Binary files a/gpsbabel/reference/lowrance.usr and b/gpsbabel/reference/lowrance.usr differ
index db446cc4e7258d37ba108e58eec72690e8d2ef9a..aaaaac8d853efc511ae09d17d15780d877b11c23 100644 (file)
@@ -4,41 +4,6 @@
 # Magellan serial
 # TODO
 
-
-#
-# Lowrance USR.  Binary, and also slightly lossy because of the math to
-# convert lat/long.  It also doesn't support description, which makes it
-# awkward  to test.
-#
-rm -f ${TMPDIR}/lowrance1.usr
-rm -f ${TMPDIR}/enchilada1.usr
-rm -f ${TMPDIR}/enchilada.gpx
-gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -o lowranceusr -F ${TMPDIR}/lowrance1.usr
-bincompare ${TMPDIR}/lowrance1.usr ${REFERENCE}/lowrance.usr
-gpsbabel -i lowranceusr -f ${TMPDIR}/lowrance1.usr -o lowranceusr -F ${TMPDIR}/lowrance1.usr
-# And because of the FP rounding, we can't even read our file, write it back
-# and get the same data.  Sigh. 
-# bincompare ${REFERENCE}/lowrance.usr  ${TMPDIR}/lowrance1.usr
-gpsbabel -i lowranceusr -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx
-gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr
-bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/enchilada.usr
-# Don't convert icons as waypts
-gpsbabel -i lowranceusr,ignoreicons -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx
-gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr
-bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/ignoreicons.usr
-
-#
-# Another variation of Lowrance.  Compare v2 and v3.  These original
-# files were saved on the same units as v2 and v3.
-#
-${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v2.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v2-unicsv.txt
-${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v3.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v3-unicsv.txt
-compare ${REFERENCE}/lowrance-v2-unicsv.txt ${TMPDIR}/lowrance-v2-unicsv.txt
-compare ${REFERENCE}/lowrance-v3-unicsv.txt ${TMPDIR}/lowrance-v3-unicsv.txt
-# Ideally, there'd be a test for v2 vs. v3 writes, but their numeric
-# instability makes this icky.
-
-#
 # CSV (Comma separated value) data.
 
 gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -o csv -F ${TMPDIR}/csv.csv
diff --git a/gpsbabel/testo.d/lowranceusr.test b/gpsbabel/testo.d/lowranceusr.test
new file mode 100644 (file)
index 0000000..a45b1bc
--- /dev/null
@@ -0,0 +1,36 @@
+
+#
+# Lowrance USR.  Binary, and also slightly lossy because of the math to
+# convert lat/long.  It also doesn't support description, which makes it
+# awkward  to test.
+#
+rm -f ${TMPDIR}/lowrance1.usr
+rm -f ${TMPDIR}/enchilada1.usr
+rm -f ${TMPDIR}/enchilada.gpx
+gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -o lowranceusr -F ${TMPDIR}/lowrance1.usr
+bincompare ${TMPDIR}/lowrance1.usr ${REFERENCE}/lowrance.usr
+
+gpsbabel -i lowranceusr -f ${TMPDIR}/lowrance1.usr -o lowranceusr -F ${TMPDIR}/lowrance1.usr
+# And because of the FP rounding, we can't even read our file, write it back
+# and get the same data.  Sigh. 
+# bincompare ${REFERENCE}/lowrance.usr  ${TMPDIR}/lowrance1.usr
+
+gpsbabel -i lowranceusr -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx
+gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr
+bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/enchilada.usr
+
+# Don't convert icons as waypts
+gpsbabel -i lowranceusr,ignoreicons -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx
+gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr
+bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/ignoreicons.usr
+#
+# Another variation of Lowrance.  Compare v2 and v3.  These original
+# files were saved on the same units as v2 and v3.
+#
+${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v2.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v2-unicsv.txt
+${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v3.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v3-unicsv.txt
+compare ${REFERENCE}/lowrance-v2-unicsv.txt ${TMPDIR}/lowrance-v2-unicsv.txt
+compare ${REFERENCE}/lowrance-v3-unicsv.txt ${TMPDIR}/lowrance-v3-unicsv.txt
+# Ideally, there'd be a test for v2 vs. v3 writes, but their numeric
+# instability makes this icky.
+